package com.doquijote.spring6.bean;

import org.springframework.beans.factory.FactoryBean;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author 421527548@qq.com
 * @version V1.0
 * @title
 * @description
 * @date 2022-11-16 10:31
 */
public class Birthday implements FactoryBean<Date> {

    private String birthday;

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    @Override
    public Date getObject() throws Exception {
        SimpleDateFormat birthdayFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date parse = birthdayFormat.parse(birthday);
        return parse;
    }

    @Override
    public Class<?> getObjectType() {
        return null;
    }
}
